Jupyter for Data Science: Exploratory analysis, statistical modeling, machine learning, and data visualization with Jupyter by Dan Toomey
Author:Dan Toomey [Toomey, Dan]
Language: eng
Format: epub
Tags: COM018000 - COMPUTERS / Data Processing, COM062000 - COMPUTERS / Data Modeling and Design, COM089000 - COMPUTERS / Data Visualization
Publisher: Packt Publishing
Published: 2017-10-19T23:00:00+00:00
Product
Product ID,
Description,
Price
Order
Order ID,
Order Date
ProductOrder
Order ID,
Product ID,
Quantity
So, an Order has a list of Product/Quantity values associated.
We can populate the data frames and move them into Spark:
from pyspark import SparkContext from pyspark.sql import SparkSession sc = SparkContext.getOrCreate() spark = SparkSession(sc) # load product set productDF = spark.read.format("csv") \ .option("header", "true") \ .load("product.csv"); productDF.show() productDF.createOrReplaceTempView("product") # load order set orderDF = spark.read.format("csv") \ .option("header", "true") \ .load("order.csv"); orderDF.show() orderDF.createOrReplaceTempView("order") # load order/product set orderproductDF = spark.read.format("csv") \ .option("header", "true") \ .load("orderproduct.csv"); orderproductDF.show() orderproductDF.createOrReplaceTempView("orderproduct")
Now, we can attempt to perform an SQL-like JOIN operation among them:
# join the tables joinedDF = spark.sql("SELECT * " \ "FROM orderproduct " \ "JOIN order ON order.orderid = orderproduct.orderid " \ "ORDER BY order.orderid") joinedDF.show()
Doing all of this in Jupyter results in the display as follows:
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8309)
Azure Data and AI Architect Handbook by Olivier Mertens & Breght Van Baelen(6798)
Building Statistical Models in Python by Huy Hoang Nguyen & Paul N Adams & Stuart J Miller(6775)
Serverless Machine Learning with Amazon Redshift ML by Debu Panda & Phil Bates & Bhanu Pittampally & Sumeet Joshi(6662)
Data Wrangling on AWS by Navnit Shukla | Sankar M | Sam Palani(6448)
Driving Data Quality with Data Contracts by Andrew Jones(6390)
Machine Learning Model Serving Patterns and Best Practices by Md Johirul Islam(6147)
Learning SQL by Alan Beaulieu(6004)
Weapons of Math Destruction by Cathy O'Neil(5795)
Big Data Analysis with Python by Ivan Marin(5392)
Data Engineering with dbt by Roberto Zagni(4399)
Solidity Programming Essentials by Ritesh Modi(4047)
Time Series Analysis with Python Cookbook by Tarek A. Atwan(3905)
Pandas Cookbook by Theodore Petrou(3608)
Blockchain Basics by Daniel Drescher(3306)
Hands-On Machine Learning for Algorithmic Trading by Stefan Jansen(2914)
Feature Store for Machine Learning by Jayanth Kumar M J(2820)
Learn T-SQL Querying by Pam Lahoud & Pedro Lopes(2803)
Mastering Python for Finance by Unknown(2748)
